<?php use_helper('I18N', 'Date') ?>
<?php include_partial('incident/assets') ?>

<div id="sf_admin_container">

  <?php include_partial('incident/flashes') ?>

  <div id="sf_admin_header">
    <?php include_partial('incident/list_header', array('pager' => $pager)) ?>
  </div>

  <div id="sf_admin_bar">
    <?php include_partial('incident/filters', array('form' => $filters, 'configuration' => $configuration)) ?>
  </div>

  <h1 class="etiquette"><a href="<?php echo url_for('incident/tabs?tab=incident') ?>"<?php if($filters['priorite']->getValue() =='') echo ' class="h1_non_activ"' ?>><?php echo __('En cours', array(), 'messages') ?></a><a href="<?php echo url_for('incident/tabs?tab=historique') ?>"<?php if($filters['priorite']->getValue() == 'A faire') echo ' class="h1_non_activ"' ?>>Historique</a></h1>
  <div id="sf_admin_content">
    <form action="<?php echo url_for('ml_incidents_collection', array('action' => 'batch')) ?>" method="post">
    <fieldset>
    <?php include_partial('incident/list', array('pager' => $pager, 'sort' => $sort, 'helper' => $helper)) ?>
    <ul class="sf_admin_actions">
      <?php if($sf_user->hasCredential('Slot')) include_partial('incident/list_batch_actions', array('helper' => $helper)) ?>
      <?php include_partial('incident/list_actions', array('helper' => $helper)) ?>
    </ul>
    </fieldset>
    </form>
  </div>

  <div id="sf_admin_footer">
    <?php include_partial('incident/list_footer', array('pager' => $pager)) ?>
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	$('h1 > a').click(function(event){
		event.preventDefault();
		if($(this).attr('class') == 'h1_non_activ'){
			if($(this).html() == 'Historique'){
				$('#ml_incidents_filters_priorite').val('');
			}else{
				$('#ml_incidents_filters_priorite').val('A faire');
			}
			$('.sf_admin_filter > form').submit();
		}
	});
});
</script>